package com.rockcent.mall.lib.repository;

import com.rockcent.common.common.PageResult;
import com.rockcent.common.domain.enumclass.Whether;
import com.rockcent.mall.lib.domain.IntegrationCashCouponWallet;
import com.rockcent.mall.lib.dto.IntegrationCashCouponWalletDto;
import com.rockcent.mall.lib.dto.IntegrationChannelDto;
import com.rockcent.mall.lib.dto.IntegrationCouponDetailRespDto;
import com.rockcent.mall.lib.dto.IntegrationCouponRespDto;

import java.math.BigDecimal;
import java.util.List;

/**
 * Created by zhangjh on 2016/12/14.
 */
public interface IntegrationCashCouponWalletRepositoryCustom {

    /**
     * @param useNum
     * @param customerId
     * @return
     */
    Long queryCashWalletCount(Long useNum, Long customerId);

    /**
     * @param useNum
     * @param customerId
     * @param pageResult
     * @return
     */
    PageResult<IntegrationCashCouponWallet> queryCashWalletListByUseNumAndCustomerId(Long useNum, Long customerId, PageResult pageResult);

    /**
     * @param discountAmount
     * @param userId
     * @param mallId
     * @return
     */
    IntegrationCashCouponWallet getCloseToCashCoupon(BigDecimal discountAmount, Long userId, Long mallId);

    /**
     * @param cashCouponId
     * @param integrationChannelId
     * @param mallId
     * @param batchPutNo
     * @return
     */
    IntegrationCashCouponWallet updateIntegrationChannelId(Long cashCouponId, Long integrationChannelId, Long mallId, Long batchPutNo);

    /**
     * @param cashCouponId
     * @param mallId
     */
    void deleteByCashCouponId(Long cashCouponId, Long mallId);

    /**
     * @param cashCouponId
     * @param integrationChannelId
     * @param mallId
     * @return
     */
    IntegrationCashCouponWallet caculateCash(Long cashCouponId, Long integrationChannelId, Long mallId);

    /**
     * @param dto
     * @param mallId
     * @param whether
     * @param page
     * @return
     */
    PageResult<IntegrationCashCouponWalletDto> findChannelCashDetail(IntegrationChannelDto dto, Long mallId, Whether whether, PageResult page);

    /**
     * @param dto
     * @param mallId
     * @param whether
     * @return
     */
    Long qrExchangeNumByChannelId(IntegrationChannelDto dto, Long mallId, Whether whether);

    /**
     * @param channelId
     * @return
     */
    List<IntegrationCouponRespDto> queryList(Long channelId);

    /**
     * @param exchangeCode
     * @return
     */
    IntegrationCashCouponWallet findByExchangeCode(String exchangeCode);

    /**
     * @param dto
     * @param mallId
     * @param no
     * @return
     */
    Double qrExchangeNumCashAmountByChannelId(IntegrationChannelDto dto, Long mallId, Whether no);

    /**
     * @param cashCouponId
     * @return
     */
    List<IntegrationCouponDetailRespDto> findByCashCounponId(Long cashCouponId);

    /**
     *
     * @param exchangeCode
     * @param integrationChannelId
     * @param whether
     * @return
     */
    IntegrationCashCouponWallet findByExchangeCodeAndIntegrationChannelIdAndIsDelete(String exchangeCode, Long integrationChannelId, Whether whether);

    /**
     * 领取数量
     * @param mallId
     * @param cashCouponId
     * @return
     */
    Long queryCashWalletReceiveCount(Long mallId, Long cashCouponId) throws Exception;

    /**
     * 使用数量
     * @param mallId
     * @param cashCouponId
     * @return
     * @throws Exception
     */
    Long queryCashWalletUseCount(Long mallId, Long cashCouponId) throws Exception;
}
